function Cache()
{
	
	var _tagNames = new Array();
	
	this.load = function(tagName, url, id)
	{
		if (!this[tagName])
		{
			this[tagName] = new Object();
			_tagNames.push(tagName);
		}
		var element       = document.createElement(tagName);
		element.src       = url;
		element.id        = id;
		this[tagName][id] = element;
	}
	
	this.get  = function(tagName, id)
	{
		return this[tagName] ? this[tagName][id] : null;
	}
	
	this.clear = function(tagName)
	{
		var i = _tagNames.length - 1;
		if (tagName)
			while (i--)
				if (_tagNames[i] == tagName)
				{
					_tagNames.splice(i, 1);
					this[tagName] = null;
					break;
				}
		else
		{
			while (i--)
				this[_tagNames[i]] = null;
			_tagNames = new Array();
		}
	}
	
	this.isReady = function()
	{
		var tagName;
		var element;
		for (var i = 0; i < _tagNames.length; i++)
		{
			tagName = _tagNames[i];
			for (var id in this[tagName])
			{
				element = this[tagName][id];
				if (
					((tagName == "img") && (!element.complete)) ||
					(((tagName == "audio") || (tagName == "video")) && (element.buffered < element.duration))
				)
					return false;
			}
				
		}
		return true;
	}
	
}